<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>登入密碼修改</title>	
	<script type="text/javascript">
	<!--	
	$(document).ready(function() {
		$('#doChangePwdBtn').click(function() {
			var errMsg = "";
			var currentPwd = $('#currentPwd').val();
			var newPwd = $('#newPwd').val();
			var confirmPwd = $('#confirmPwd').val();			
			
			if (null == currentPwd || 0 == currentPwd.length){
				errMsg = errMsg + "目前密碼 是必要欄位<br/>";
			}
			
			if (null == newPwd || 0 == newPwd.length){
				errMsg = errMsg + "新密碼 是必要欄位<br/>";
			}
			
			if (null == confirmPwd || 0 == confirmPwd.length){
				errMsg = errMsg + "確認新密碼 是必要欄位<br/>";
			}
			
			if (newPwd != confirmPwd){
				errMsg = errMsg + "新密碼 與 確認新密碼 不符<br/>";
			}
			
			if (0 != errMsg.length){
				$("#ajaxErrorMessageDiv").html(errMsg);
				$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
				$("#ajaxErrorMessageDiv" ).dialog({  
					title:'請修正下列錯誤'
					,width: 300
					, resizable: false
					, modal: true
					, buttons: {
						Ok: function() {
							$( this ).dialog( "close" );
						}
					}
				});
				return false;
			}
			
			return true;
		});
		
	});
	
	//-->
	</script>
</head>
<body>
<div id="mainAreaCT">
		<jsp:include page="/includes/path.jsp"/>
		<jsp:include page="/includes/subMenu.jsp"/>
		
	<div id="queryFormDiv">
		<stripes:form id="changePwdFrom" beanclass="com.feib.soeasy.action.Soez9011ActionBean" 
			method="post" onsubmit="javascript: waitingDialog({});">
		<h3 class="pageTitle">登入密碼修改</h3>
		<table id="queryForm">
			<tr>
				<th>業者代號</th>
				<td>
					<c:out value="${actionBean.user.group.groupNo }"/>
				</td>
			</tr>
			<tr>
				<th>登入帳號</th>
				<td>
					<c:out value="${actionBean.user.userId }"/>
				</td>
			</tr>
			<tr>
				<th>目前密碼<span id="mustKeyInStar">**</span></th>
				<td>
					<stripes:password id="currentPwd" name="currentPwd" size="20" maxlength="20"/>
				</td>
			</tr>
			<tr>
				<th>新密碼<span id="mustKeyInStar">**</span></th>
				<td>
					<stripes:password id="newPwd" name="newPwd" size="20" maxlength="20"/>
				</td>
			</tr>
			<tr>
				<th>確認新密碼<span id="mustKeyInStar">**</span></th>
				<td>
					<stripes:password id="confirmPwd" name="confirmPwd" size="20" maxlength="20"/>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="queryFunction">
					<stripes:submit id="doChangePwdBtn" name="doChangePwd" value="變更密碼" class="formBtn"/>
				</td>
			</tr>
		</table>
		</stripes:form>
	</div><!-- end #queryForm -->
	
	<!-- Message -->
	<div id="ajaxErrorMessageDiv" style="display: none;"></div>
	
	
	<c:if test="${null != actionBean.message }">
	<script type="text/javascript">
	<!--
	$("#ajaxErrorMessageDiv").html('${actionBean.message }');
	$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
	$("#ajaxErrorMessageDiv" ).dialog({  
		title:'登入密碼修改' 
		, width: 400
		, resizable: false
		, modal: true
		, buttons: {
			Ok: function() {
				$( this ).dialog( "close" );
				
				if (1==$("#doChangePwdResultCode").val()){
					document.location = "<c:url value='${actionBean.loginUrl}'/>";
				}
			}
		}
	});
	//-->
	</script>
	</c:if>
	
</div>
</body>
</html>